****to be reported
*variables
*energyp = dependent variable, proportion of renewable energy project in firm's projects' portfolio
*stdeuaprice2 = carbon prices as market incentives
*stdroa2 = slack resources or return on assets
*stdconstraint2 = network closure
*stdndoeratio2 = normative pressure
*stdavscale2 = scale of investments
*stdage2 = firm age
*stdneigenvec2 = social status
*stdrjrate = firm experience
*stdnetsize2 = network size


*no serial correlation
xi:collin energyp stdeuaprice2 stdroa2 stdconstraint2 stdndoeratio2 stdavscale2 stdage2 stdneigenvec2 if non_anex_cntries==1 & (energyp==1|energyp==0)& euaprice>0 & age>0

*user cluster robust error to address the issue of autocorrelation
xi:xtserial energyp stdeuaprice2 stdroa2 stdconstraint2 stdndoeratio2 stdavscale2 stdage2 stdneigenvec2 if non_anex_cntries==1 & (energyp==1|energyp==0)& euaprice>0 & age>0

********
probit energyp c.stdeuaprice2##c.stdconstraint2 stdroa2 stdndoeratio2 stdavscale2 stdage2 stdneigenvec2 if non_anex_cntries==1 & (energyp==1|energyp==0)& euaprice>0 & age>0, vce(cluster cntcode)
estimates store prob
ivprobit energyp stdeuaprice2 c.stdeuaprice2#c.stdconstraint2 stdroa2 (stdconstraint2=stdrjrate stdnetsize2) stdndoeratio2 stdavscale2 stdage2 stdneigenvec2 if non_anex_cntries==1 & (energyp==1|energyp==0)& euaprice>0 & age>0, vce(cluster cntcode)
estimates store ivprob
estimates table prob ivprob,star(0.001 0.05 0.1)

******
gen pricenet = c.stdeuaprice2#c.stdconstraint2
ivprobit energyp stdeuaprice2 pricenet stdroa2 (stdconstraint2=stdrjrate stdnetsize2) stdndoeratio2 stdavscale2 stdage2 stdneigenvec2 if non_anex_cntries==1 & (energyp==1|energyp==0)& euaprice>0 & age>0, twostep
overid
ivprobit energyp stdeuaprice2 pricenet stdroa2 (stdconstraint2=stdrjrate stdnetsize2) stdndoeratio2 stdavscale2 stdage2 stdneigenvec2 if non_anex_cntries==1 & (energyp==1|energyp==0)& euaprice>0 & age>0, twostep
weakiv



***********************
qui:probit energyp stdndoeratio2 stdavscale2 stdage2 stdneigenvec2 if non_anex_cntries==1 & (energyp==1|energyp==0)& euaprice>0 & age>0, vce(cluster cntcode)
estimates store cont

qui:probit energyp stdeuaprice2 stdndoeratio2 stdavscale2 stdage2 stdneigenvec2 if non_anex_cntries==1 & (energyp==1|energyp==0)& euaprice>0 & age>0, vce(cluster cntcode)
estimates store price

qui:probit energyp stdroa2 stdndoeratio2 stdavscale2 stdage2 stdneigenvec2 if non_anex_cntries==1 & (energyp==1|energyp==0)& euaprice>0 & age>0, vce(cluster cntcode)
estimates store perf

qui:probit energyp stdconstraint2 stdndoeratio2 stdavscale2 stdage2 stdneigenvec2 if non_anex_cntries==1 & (energyp==1|energyp==0)& euaprice>0 & age>0, vce(cluster cntcode)
estimates store net

qui:probit energyp c.stdeuaprice2##c.stdconstraint2 stdndoeratio2 stdavscale2 stdage2 stdneigenvec2 if non_anex_cntries==1 & (energyp==1|energyp==0)& euaprice>0 & age>0, vce(cluster cntcode)
estimates store pricenet

*estimates table cont price perf net pricenet, star(0.001 0.05 0.1) stats(r2_p aic bic p df_m N_clust)


*********
**robust models
qui:fracreg probit energyp c.stdeuaprice2##c.stdconstraint2 stdroa2  stdndoeratio2 stdavscale2 stdage2 stdneigenvec2 if non_anex_cntries==1 & (energyp==1|energyp==0)& euaprice>0 & age>0, vce(cluster cntcode)
estimates store fraclog
qui:glm energyp c.stdeuaprice2##c.stdconstraint2 stdroa2 stdndoeratio2 stdavscale2 stdage2 stdneigenvec2 if non_anex_cntries==1 & (energyp==1|energyp==0)& euaprice>0 & age>0, family(binomial 1) link(probit) vce(cluster cntcode)
estimates store glmreg
qui:glm energyp c.stdeuaprice2##c.stdconstraint2 stdroa2 stdndoeratio2 stdavscale2 stdage2 stdneigenvec2 if non_anex_cntries==1 & euaprice>0 & age>0, family(binomial 1) link(probit) vce(cluster cntcode)
estimates store glmregfull
estimates table probcont probfull fraclog glmreg glmregfull,star(0.001 0.05 0.1)


*Granger causality test; energyp does granger cause constraint; constraint does!
probit energyp l.energyp l.stdeuaprice2 l.stdroa2 l.stdconstraint2 l.stdndoeratio2 l.stdavscale2 l.stdage2 l.stdneigenvec2 if non_anex_cntries==1 & (energyp==1|energyp==0)& euaprice>0 & age>0, vce(cluster cntcode)
test l.stdconstraint2 l.stdndoeratio2 l.stdavscale2 l.stdneigenvec2

xi:xtreg constraint l.constraint l.energyp stdeuaprice2 stdroa2 stdndoeratio2 stdavscale2 stdage2 stdneigenvec2 if non_anex_cntries==1 & (energyp==1|energyp==0)& euaprice>0 & age>0,vce(cluster cntcode) re
test l.energyp

xi:xtreg neigenvec l.neigenvec l.constraint l.energyp stdeuaprice2 stdroa2 stdndoeratio2 stdavscale2 stdage2 if non_anex_cntries==1 & (energyp==1|energyp==0)& euaprice>0 & age>0,vce(cluster cntcode) re
 test l.energyp
